package edu.se.jai.lesson05nacos.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 应用配置类 - 使用@ConfigurationProperties
 * 支持从application.yml读取默认配置，Nacos配置会覆盖这些默认值
 * 支持配置热更新，无需重启应用
 */
@Component
@ConfigurationProperties(prefix = "app")
@Data
public class AppConfig {

    /**
     * 功能开关
     */
    private Feature feature = new Feature();

    /**
     * 业务配置
     */
    private Business business = new Business();

    @Data
    public static class Feature {
        private Boolean enableLog = true;
    }

    @Data
    public static class Business {
        private String welcomeMessage = "欢迎使用Nacos配置管理演示系统！";
        private Integer maxUsers = 10000;
        private Boolean enableRegistration = false;
        private String defaultLanguage = "zh-CN";
    }
}
